package com.sales.fallback;

import com.sales.controller.QuotationController;
import org.comple.erp.pojo.base.customer.CustomerLevel;
import org.comple.erp.remote.base.CustomerLevelRemote;
import org.comple.erp.utils.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


@Component
public class CustomerLevelClientFallback implements FallbackFactory<CustomerLevelRemote> {
    private final Logger logger = LoggerFactory.getLogger(CustomerLevelClientFallback.class);


    @Override
    public CustomerLevelRemote create(Throwable cause) {
        return new CustomerLevelRemote() {
            @Override
            public AjaxResult selectAll() {
                logger.debug(cause.toString()+"进行熔断处理");

                return AjaxResult.back("5600", "系统繁忙，请稍后再试").add("test", new ArrayList<>());
            }

        };

    }
}
